home *** CD-ROM | disk | FTP | other *** search
- /* ViewIt 2.2 Demonstration Program */
- /* ©FaceWare 1991-93. All Rights Reserved. */
-
- #include "string.h"
- #include "FaceStorLC.h"
- extern struct FaceRec fRec;
-
- short helpShown;
- struct {
- short myInteger;
- float myReal;
- char myString[100];
- long myFlags;
- } myRec;
- short myList;
- long oldTicks,newTicks;
- float theReal,delta;
-
- pascal void fJumpIt(Ptr thePtr) = {0x2257,0x2051,0x4E90};
-
- pascal void OverProc(Ptr thePtr) {
- if (fRec.uCommand == 264) /* a key down message? */
- if (fRec.uParam[0] == 32) /* SPACE key pressed? */
- fRec.uParam[0] = 95; /* convert to UNDERLINE */
- fJumpIt(thePtr);} /* pass message to driver */
-
- void main()
- {
- myRec.myInteger = 0;
- myRec.myReal = 6.2;
- strcpy(myRec.myString,"Hello");
- myRec.myFlags = 10;
- myList = 2;
- oldTicks = 0;
- theReal = 6.0;
-
- /* Initialize FaceIt */
- strcpy(fRec.uName, "vDemo.Rsrc");
- FaceIt(0L,DoInit,0L,0L,0L,0L);
-
- /* Open Modeless Window using FWND 1000 */
- FaceIt(0L,NewWnd,1000L,1L,0L,0L);
-
- for (;;) {
- FaceIt(0L,DoLoop,0L,0L,0L,0L);
- /* Standard "About" Menu Item Selection */
- if ((fRec.uMenuID == 101L) && (fRec.uMenuItem == 1L)) {
- strcpy(fRec.uString, "Demonstration of the use of ViewIt\rwindows in a FaceIt-based program.");
- FaceIt(0L,ShoStr,3L,12L,(1L + (409L * 65536L)),0L);
- }
- /* Hit in Modeless Window's "Open Modal" Button */
- else if ((fRec.uMenuID == 1000L) && (fRec.wcHit == 2L)) {
- FaceIt(0L,NewWnd,1001L,0L,0L,0L); /* Open Modal Window */
- for (;;) {
- FaceIt(0L,MdlWnd,1001L,0L,0L,0L); /* Process Modal Events */
- if (fRec.wcHit == -1L) /* Hit in Close Box */
- break;
- else if (fRec.wcHit == 1L) { /* Hit in "Open Nested" Button */
- FaceIt(0L,NewWnd,1002L,0L,0L,(long)&myRec); /* Open Nested Modal */
- FaceIt(0L,GetCtl,1002L,0L,3L,3L); /* Link Scrollable List */
- FaceIt(0L,LnkCtl,(long)fRec.cControl,(long)&myList,2L,0L);
- FaceIt(0L,GetCtl,1002L,0L,2L,3L); /* Set Override Proc */
- FaceIt(0L,OvrCtl,(long)fRec.cControl,(long)&OverProc,0L,0L);
- FaceIt(0L,SetVal,1002L,0L,0L,0L); /* Set Linked Values */
- helpShown = false;
- for (;;) {
- FaceIt(0L,MdlWnd,1002L,-2L,0L,0L); /* Process Modal Events */
- if (fRec.uMenuID == 0L) { /* No Message */
- newTicks = TickCount();
- if (newTicks > oldTicks + 60) {
- oldTicks = newTicks;
- FaceIt(0L,GetCtl,1002L,0L,2L,8L);
- SetCtlValue(fRec.cControl,(fRec.cValue % 4) + 1);
- }
- }
- else if (fRec.wvHit == 1L) { /* Hit in View #1 */
- if (fRec.wcHit == 1L) /* Hit in "OK" Button */
- break;
- else if (fRec.wcHit == 2L) { /* Hit in "Show/Hide" */
- if (helpShown == true) {
- FaceIt(0L,ShoCtl,0L,0L,-3L,2L); /* Hide v3, Show v2 */
- helpShown = false;}
- else {
- FaceIt(0L,ShoCtl,0L,0L,-2L,3L); /* Hide v2, Show v3 */
- helpShown = true;}
- }
- }
- else if (fRec.wvHit == 2L) /* Hit in View #2 */
- if ((fRec.wcHit == 6L)||(fRec.wcHit == 7L)) { /* Up/Down Arrow */
- FaceIt(0L,GetCtl,1002L,0L,2L,(long)fRec.wcHit);
- delta = 0.001 * (fRec.cMin - 2);
- myRec.myReal = myRec.myReal + delta;
- FaceIt(0L,SetVal,1002L,0L,2L,2L);
- Delay(5,&fRec.uI4);
- }
- }
- FaceIt(0L,GetVal,1002L,0L,0L,0L); /* Get Linked Values */
- FaceIt(0L,EndWnd,1002L,0L,0L,0L); /* Close Nested Modal */
- }
- }
- FaceIt(0L,EndWnd,1001L,0L,0L,0L); /* Close Modal Window */
- }
- /* Hit in Modeless Window's "Why ViewIt?" Button */
- else if ((fRec.uMenuID == 1000L) && (fRec.wcHit == 3L)) {
- FaceIt(0L,NewWnd,1003L,0L,0L,(long)&theReal);
- FaceIt(0L,SetVal,1003L,0L,0L,0L);
- for (;;) {
- FaceIt(0L,MdlWnd,1003L,0L,0L,0L);
- if (fRec.wcHit == 1L) break;}
- FaceIt(0L,GetVal,1003L,0L,0L,0L);
- FaceIt(0L,EndWnd,1003L,0L,0L,0L);
- }
- }
- }